#!/usr/bin/perl -w
my $obj=$ARGV[0];
my $asm;
$obj=~s/\.[c|S|o]$/.o/;
($asm=$ARGV[0])=~s/\.[c|S|o]$/.s/;
system(qq(rm -f $obj));
open F,qq(make $ARGV[0] |);
my ($cmd,$cmd1);
while(<F>){$cmd=$_;last if/gcc/;};
close F;
shift @ARGV;
($cmd1=$cmd)=~s/\s-c\s/ @ARGV -S -fverbose-asm /;
print STDERR "$cmd1\n";
system qq($cmd1);
print STDERR qq($asm\n);
system qq(cp $asm /tmp/tmp.S);
print STDERR "$cmd\n";
system qq($cmd);
system qq(cp $obj /tmp/tmp.o;${CROSS_COMPILE}objdump -Slz /tmp/tmp.o >/tmp/tmp.s);
$cmd=~s/\s-c\s/ @ARGV -E -C /;
print STDERR "$cmd\n";
system($cmd);
